This article provides instructions on how to add the Ditto package to your project, import and initialize Ditto, and prepare React Native apps targeting iOS and Android for usage with the Ditto SDK:
package.json
file:
Info.plist
file, add the following key-value pairs:Info.plist
as source code, right-click the file from the left sidebar in Xcode > click Open As > and then select Source Code from the menu.24
or higher:build.gradle
located in the android
root directory.minSDKVersion
to 24
.android/gradle.properties
.build.gradle
located in the android/app
directory.dependencies
block located at the bottom of the file:build.gradle
located in the android/app
directory:App
), use this helper function to request permissions if developing for the Android target:
startSync()
, do the following:
ditto
object with the specified identity. (Creating a New Ditto Instance)onlinePlayground
— Explore platform features and functionality without setting up your authentication mechanism.onlineWithAuthentication
— If developing a production-level app, integrate your own identity provider, such as Auth0, identify users, give users read or write control, and integrate with your existing authentication systems.onlineWithAuthentication
identity when developing a production app for deployment.
try
statement, instantiate a new Ditto
object with the identity you’ve specified:
TransportConfig
instance, do the following to set up transport configurations in your app:
document
), creates a subscription for the Cars
collection, executes database operations and logs the results, registers an observer for watching changes in the Cars
collection:
smallPeerInfo
directly on the Ditto instance.
Debug
:
ios/Podfile
file in your project, set the minimum deployment target for iOS:ios
directory in your project, update CocoaPods dependencies:sudo
command, run your project with elevated privileges.